import 'package:cateapp/generated/json/base/doc_home_list_news_entity.dart';

docHomeListNewsEntityFromJson(DocHomeListNewsEntity data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code']?.toString();
	}
	if (json['msg'] != null) {
		data.msg = json['msg'];
	}
	if (json['data'] != null) {
		data.data = new DocHomeListNewsData().fromJson(json['data']);
	}
	if (json['timestamp'] != null) {
		data.timestamp = json['timestamp']?.toString();
	}
	return data;
}

Map<String, dynamic> docHomeListNewsEntityToJson(DocHomeListNewsEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['timestamp'] = entity.timestamp;
	return data;
}

docHomeListNewsDataFromJson(DocHomeListNewsData data, Map<String, dynamic> json) {
	if (json['notice'] != null) {
		data.notice = new List<dynamic>();
		data.notice.addAll(json['notice']);
	}
	if (json['recommend'] != null) {
		data.recommend = new List<DocHomeListNewsDataRecommand>();
		(json['recommend'] as List).forEach((v) {
			data.recommend.add(new DocHomeListNewsDataRecommand().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> docHomeListNewsDataToJson(DocHomeListNewsData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.notice != null) {
		data['notice'] =  [];
	}
	if (entity.recommend != null) {
		data['recommend'] =  entity.recommend.map((v) => v.toJson()).toList();
	}
	return data;
}

docHomeListNewsDataRecommandFromJson(DocHomeListNewsDataRecommand data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toString();
	}
	if (json['unitId'] != null) {
		data.unitId = json['unitId']?.toString();
	}
	if (json['title'] != null) {
		data.title = json['title']?.toString();
	}
	if (json['viewed'] != null) {
		data.viewed = json['viewed']?.toString();
	}
	if (json['unitName'] != null) {
		data.unitName = json['unitName']?.toString();
	}
	if (json['mainPicpath'] != null) {
		data.mainPicpath = json['mainPicpath']?.toString();
	}
	if (json['created'] != null) {
		data.created = json['created']?.toString();
	}
	return data;
}

Map<String, dynamic> docHomeListNewsDataRecommandToJson(DocHomeListNewsDataRecommand entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['unitId'] = entity.unitId;
	data['title'] = entity.title;
	data['viewed'] = entity.viewed;
	data['unitName'] = entity.unitName;
	data['mainPicpath'] = entity.mainPicpath;
	data['created'] = entity.created;
	return data;
}